package com.ars.common.servlet;

import com.ars.common.beans.User.User;

import com.ars.common.servlet.Userservlet.GetUser;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet("/EditAdminServlet")
public class EditAdminServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) {
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String id = request.getParameter("id");
        User user = new User();

        try {
            user = new GetUser().findId(id);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }


        request.setAttribute("user", user);
        request.getRequestDispatcher("/admin/EditAdmin.jsp").forward(request, response);
    }
}
